package com.rocsea.robot.factory;
import com.rocsea.robot.template.Template;

import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author RocSea
 * @Date 2022/12/7
 */
public final class KettleTemplateFactory {

    private KettleTemplateFactory() {
        // hide constructor
    }

    private static final Map<String, Template> templateMap = new ConcurrentHashMap<>();

    public static void register(String name, Template template) {
        if (!Objects.isNull(template)) {
            templateMap.put(name, template);
        }
    }

    public static Template getTemplate(String name){
        return templateMap.get(name);
    }
}
